package model;
import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import common.kit.DateKits;
import model.base.BaseReagentRenewal;

@SuppressWarnings("serial")
public class ReagentRenewal extends BaseReagentRenewal<ReagentRenewal> {
    public static final ReagentRenewal dao = new ReagentRenewal().dao();
    

	public List<Record> findByGroupId(Long groupId){
		List<Record> list = Db.find(" SELECT trr.id,trr.createTime,trr.instrumentName,trr.reagentName,trr.potency,trr.deadline,trr.creator FROM t_reagent_renewal trr WHERE trr.groupId = ?  ORDER BY trr.createTime " , groupId);
		for (Record record : list) {
			record.set("isDued", record.getDate("deadline").getTime() <= System.currentTimeMillis() );
			record.set("deadline", DateKits.toStr(record.getDate("deadline")));
		}
		return list ;
    }
}
